package com.hfut.eeg.common.component;

import org.springframework.stereotype.Component;

import java.util.ArrayList;

/**
 * @author 梁琦
 * @program: eeg
 * @Package com.hfut.eeg.common.component
 * @Description: 供前台显示实时EEG数据
 * @date 2019-12-16 09:58
 */
@Component
public class RealTimeEEG {
    private ArrayList<ArrayList> EEG;

    public RealTimeEEG(ArrayList<ArrayList> EEG) {
        this.EEG = EEG;
    }

    public RealTimeEEG() {
        EEG = new ArrayList<>();
        for (int i=0;i<16;i++){
            EEG.addAll(new ArrayList<>());
        }
    }

    public synchronized ArrayList<ArrayList> getEEG() {
        return EEG;
    }

    public synchronized void setEEG(ArrayList<ArrayList> data) {
        for (int i=0;i<EEG.size();i++){
            EEG.get(i).addAll(data.get(i));
        }
    }

    //清空
    public synchronized void clear(){
        for (ArrayList list:EEG){
            list.clear();
        }
    }


}
